// 时针
const hour = document.getElementById('hour');
// 分针
const minute = document.getElementById('minute');
// 秒针
const second = document.getElementById('second');
const time = document.querySelector('.time');
const month = document.querySelector('.clockText');
const day = document.querySelector('.day');
const calcAngle = () => {
  const current = new Date();
  // 计算时针的角度
  let hourdeg = current.getHours();
  hour.style.transform = `rotate(${((hourdeg % 12) / 12) * 360 - 90}deg)`;
  // 计算分针的角度
  let minutedeg = current.getMinutes();
  minute.style.transform = `rotate(${(minutedeg / 60) * 360 - 90}deg)`;
  // 计算秒针的角度
  let seconddeg = current.getSeconds();
  second.style.transform = `rotate(${(seconddeg / 60) * 360 - 90}deg)`;
  // 设置时间文本
  time.innerHTML = current.getHours() + ':' + current.getMinutes();
  month.innerHTML = current.getMonth() + 1 + '月';
  day.innerHTML = current.getDate() + '日';
};

calcAngle();

setInterval(calcAngle, 1000);
